<!DOCTYPE html>
<html>
<head>
    <title>页面跳转</title>
    <script>
        var _hmt = _hmt || [];
        (function() {
          var hm = document.createElement("script");
          hm.src = "https://hm.baidu.com/hm.js?8e9e3f2461b777ccbdd412f816851fc9";
          var s = document.getElementsByTagName("script")[0]; 
          s.parentNode.insertBefore(hm, s);
        })();
    </script>
        
    <script>
        // 获取URL参数
        function getParameterByName(name) {
            name = name.replace(/[\[\]]/g, '\\$&');
            let regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
                results = regex.exec(window.location.href);
            if (!results) return null;
            if (!results[2]) return '';
            return decodeURIComponent(results[2].replace(/\+/g, ' '));
        }

        // 检查目录是否存在
        function directoryExists(dir) {
            try {
                const xhr = new XMLHttpRequest();
                xhr.open('HEAD', dir, false);
                xhr.send();
                return xhr.status !== 404;
            } catch (e) {
                return false;
            }
        }

        // 主逻辑
        const wechatId = getParameterByName('wechat_id');
        const defaultDir = 'lxm503527381';
        const targetDir = wechatId && directoryExists(wechatId) ? wechatId : defaultDir;
        
        // 跳转
        window.location.href = targetDir + '/index.html';
    </script>
</head>
<body>
    <p>跳转中...</p>
</body>
</html>
